import http from "./request";

//轮播图数据
export const getSwiper = () => http.get("/api/swiper");

//注册
export const getReg = (data) => http.post("/api/register", data);

//验证码
export const getCode = (tel) =>
  http.get("/api/login/code", {
    params: { tel },
  });

//用户名登录
export const getLogin = (data) => http.post("/api/login", data);

//手机号登录
export const getPhone = (data) => http.post("/api/login/tel", data);

//城市定位
export const getCityLocation = () =>
  http.get("/api/city/location", {
    params: { key: "c93b0909343a20ccd7aa06f4317b133a" },
  });

//城市列表
export const getCity = () => http.get("/api/city");

//搜索城市
export const searchCity = (kw) =>
  http.get("/api/city/search", {
    params: { kw },
  });

//车次列表
export const getTrain = (data) => http.post("/api/trip/train", data);

//车次详情
export const getDetail = (id, query) =>
  http.get(`/api/trip/train/${id}`, { params: query });

//创建订单
export const getOrder = (data) => http.post("/api/order/create", data);

//订单详情
export const getPay = (order_no) =>
  http.get("/api/order/status", {
    params: { order_no },
  });

//乘车人列表
export const getPsg = () => http.get("/api/passengers");

//增加乘车人
export const addPsg = (data) => http.post("/api/passengers", data);

//编辑乘车人
export const editPsg = (data) => http.put("/api/passengers", data);

//删除乘车人
export const delPsg = (id) =>
  http.delete("/api/passengers/" + id, {
    params: { id },
  });

//OCR
export const getocr = (data) => http.post("/api/orc/upload/image", data);
